<?php

namespace app\common\validate;
use think\Validate;
USE app\common\model\News as NewsModel;

class News extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'title'          => 'require',
        'image'          => 'require',
        'content'        => 'require',
        'type'           => 'require|number',
        'introduction'   => 'require',
//        'url'       =>'requireIf:type,' . NewsModel::TYPE_HANG . '|max:255',
    ];

    /**
     * 提示消息
     */
    protected $message = [];

    /**
     * 字段描述
     */
    protected $field = [
        'title'         => '标题',
        'image'         => '图片',
        'content'       => '内容',
        'type'          => '类型',
        'url'           => '外链地址',
        'introduction'  => '简介',
    ];

    protected $scene = [
        'add'   =>  ['title', 'image','content', 'type'],
        'edit'  =>  ['title', 'image','content', 'type'],
    ];
}
